{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# torchvision.models\n",
    "\n",
    "torchvision.models模块的 子模块中包含以下模型结构。\n",
    "- AlexNet\n",
    "- DenseNet \n",
    "- Inception3\n",
    "- ResNet\n",
    "- SqueezeNet\n",
    "- VGG\n",
    "- alexnet\n",
    "- densenet\n",
    "- densenet121\n",
    "- densenet161\n",
    "- densenet169 \n",
    "- densenet201 \n",
    "- inception\n",
    "- inception_v3 \n",
    "- resnet \n",
    "- resnet101\n",
    "- resnet152\n",
    "- resnet18 \n",
    "- resnet34\n",
    "- resnet50\n",
    "- squeezenet\n",
    "- squeezenet1_0\n",
    "- squeezenet1_1\n",
    "- vgg\n",
    "- vgg11\n",
    "- vgg11_bn \n",
    "- vgg13 \n",
    "- vgg13_bn\n",
    "- vgg16 \n",
    "- vgg16_bn\n",
    "- vgg19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "#你可以使用随机初始化的权重来创建这些模型。\n",
    "import torchvision.models as models\n",
    "resnet18 = models.resnet18()\n",
    "alexnet = models.alexnet()\n",
    "squeezenet = models.squeezenet1_0()\n",
    "densenet = models.densenet161()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Downloading: \"https://download.pytorch.org/models/alexnet-owt-4df8aa71.pth\" to C:\\Users\\Hurf/.cache\\torch\\checkpoints\\alexnet-owt-4df8aa71.pth\n",
      "100.0%\n"
     ]
    }
   ],
   "source": [
    "#我们也提供了预训练(pre-trained)的模型\n",
    "import torchvision.models as models\n",
    "#pretrained=True就可以使用预训练的模型\n",
    "resnet18 = models.resnet18(pretrained=True)\n",
    "alexnet = models.alexnet(pretrained=True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### AlexNet 模型结构 \n",
    "torchvision.models.alexnet(pretrained=False, ** kwargs)  \n",
    "参数：  \n",
    "- pretrained (bool) – True, 返回在ImageNet上训练好的模型。\n",
    "\n",
    "### ResNet18 模型 \n",
    "torchvision.models.resnet18(pretrained=False, ** kwargs)    \n",
    "参数：  \n",
    "- pretrained (bool) – True, 返回在ImageNet上训练好的模型。  \n",
    "\n",
    "### ResNet-34 模型 \n",
    "torchvision.models.resnet34(pretrained=False, ** kwargs)   \n",
    "参数：  \n",
    "- pretrained (bool) – True, 返回在ImageNet上训练好的模型。\n",
    "\n",
    "### ResNet-50 模型\n",
    "torchvision.models.resnet50(pretrained=False, ** kwargs)\n",
    "参数：\n",
    "- pretrained (bool) – True, 返回在ImageNet上训练好的模型。\n",
    "\n",
    "### ResNet-101 模型\n",
    "torchvision.models.resnet101(pretrained=False, ** kwargs)  \n",
    "参数：  \n",
    "- pretrained (bool) – True, 返回在ImageNet上训练好的模型。\n",
    "\n",
    "### ResNet-152 模型\n",
    "torchvision.models.resnet152(pretrained=False, ** kwargs)  \n",
    "参数：  \n",
    "- pretrained (bool) – True, 返回在ImageNet上训练好的模型。\n",
    "\n",
    "### VGG 11-layer 模型\n",
    "torchvision.models.vgg11(pretrained=False, ** kwargs)  \n",
    "VGG 11-layer model (configuration “A”)   \n",
    "参数：  \n",
    "- pretrained (bool) – True, 返回在ImageNet上训练好的模型。\n",
    "\n",
    "### BN VGG 11-layer 模型\n",
    "torchvision.models.vgg11_bn(** kwargs)  \n",
    "VGG 11-layer model (configuration “A”) with batch normalization\n",
    "\n",
    "### VGG 13-layer 模型\n",
    "torchvision.models.vgg13(pretrained=False, ** kwargs)  \n",
    "VGG 13-layer model (configuration “B”)  \n",
    "参数：  \n",
    "- pretrained (bool) – True, 返回在ImageNet上训练好的模型。\n",
    "\n",
    "### BN VGG 13-layer 模型\n",
    "torchvision.models.vgg13_bn(** kwargs)  \n",
    "VGG 13-layer model (configuration “B”) with batch normalization\n",
    "\n",
    "### VGG 16-layer 模型\n",
    "torchvision.models.vgg16(pretrained=False, ** kwargs)  \n",
    "VGG 16-layer model (configuration “D”)  \n",
    "参数：  \n",
    "- pretrained (bool) – If True, returns a model pre-trained on ImageNet\n",
    "\n",
    "### BN VGG 16-layer 模型\n",
    "torchvision.models.vgg16_bn(** kwargs)  \n",
    "VGG 16-layer model (configuration “D”) with batch normalization\n",
    "\n",
    "### VGG 19-layer 模型\n",
    "torchvision.models.vgg19(pretrained=False, ** kwargs)  \n",
    "VGG 19-layer model (configuration “E”)  \n",
    "参数：  \n",
    "- pretrained (bool) – True, 返回在ImageNet上训练好的模型。\n",
    "\n",
    "### BN VGG 19-layer 模型\n",
    "torchvision.models.vgg19_bn(** kwargs)  \n",
    "VGG 19-layer model (configuration ‘E’) with batch normalizatio"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.2"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
